package com.ruoyi.clerkBalanceRecord.service.impl;

import com.ruoyi.clerkBalance.mapper.ClerkBalanceMapper;
import com.ruoyi.clerkBalanceRecord.domain.ClerkBalanceRecord;
import com.ruoyi.clerkBalanceRecord.mapper.ClerkBalanceRecordMapper;
import com.ruoyi.clerkBalanceRecord.service.IClerkBalanceRecordService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
public class ClerkBalanceRecordServiceImpl implements IClerkBalanceRecordService {

    @Autowired
    private ClerkBalanceRecordMapper clerkBalanceRecordMapper;
    /**
     * 查询余额流水
     *
     * @param id 余额流水主键
     * @return 余额流水
     */
    @Override
    public ClerkBalanceRecord selectClerkBalanceRecordById(Long id)
    {
        return clerkBalanceRecordMapper.selectClerkBalanceRecordById(id);
    }

    /**
     * 查询余额流水列表
     *
     * @param clerkBalanceRecord 余额流水
     * @return 余额流水
     */
    @Override
    public List<ClerkBalanceRecord> selectClerkBalanceRecordList(ClerkBalanceRecord clerkBalanceRecord)
    {
        return clerkBalanceRecordMapper.selectClerkBalanceRecordList(clerkBalanceRecord);
    }

    /**
     * 新增余额流水
     *
     * @param clerkBalanceRecord 余额流水
     * @return 结果
     */
    @Override
    public int insertClerkBalanceRecord(ClerkBalanceRecord clerkBalanceRecord)
    {
        clerkBalanceRecord.setCreateTime(DateUtils.getNowDate());
        return clerkBalanceRecordMapper.insertClerkBalanceRecord(clerkBalanceRecord);
    }

    /**
     * 修改余额流水
     *
     * @param clerkBalanceRecord 余额流水
     * @return 结果
     */
    @Override
    public int updateClerkBalanceRecord(ClerkBalanceRecord clerkBalanceRecord)
    {
        return clerkBalanceRecordMapper.updateClerkBalanceRecord(clerkBalanceRecord);
    }

    /**
     * 批量删除余额流水
     *
     * @param ids 需要删除的余额流水主键
     * @return 结果
     */
    @Override
    public int deleteClerkBalanceRecordByIds(Long[] ids)
    {
        return clerkBalanceRecordMapper.deleteClerkBalanceRecordByIds(ids);
    }


    /**
     * 批量逻辑删除余额流水
     *
     * @param ids 需要删除的余额流水主键
     * @return 结果
     */
    @Override
    public int logicDeleteClerkBalanceRecord(Long[] ids,String delType,Long delUser)
    {
        return clerkBalanceRecordMapper.logicDeleteClerkBalanceRecord(ids,delType,delUser);
    }

    /**
     * 删除余额流水信息
     *
     * @param id 余额流水主键
     * @return 结果
     */
    @Override
    public int deleteClerkBalanceRecordById(Long id)
    {
        return clerkBalanceRecordMapper.deleteClerkBalanceRecordById(id);
    }

    @Override
    public BigDecimal selectData(Long storeUserId, Date date) {
        return clerkBalanceRecordMapper.selectData(storeUserId,date);
    }
}
